<template>
  <div id="app" class="drag">
    <div class="menu-top">
      <menu-top></menu-top>
    </div>
    <div class="player">
      <player></player>
    </div>
  </div>
</template>

<script>
  import MenuTop from '@/components/menu-top'
  import Player from '@/components/Player'

  export default {
    name: 'video_player',
    components: {
        MenuTop,
        Player,
    },
      created() {
          window.addEventListener('online',function(e) {
              this.alertOnlineStatus();
          });
          window.addEventListener('offline',function(e) {
              this.alertOnlineStatus();
          });
      },
      methods: {
          alertOnlineStatus() {
              window.alert(navigator.onLine ? 'online' : 'offline')
          }
      },
      ready() {

          window.addEventListener('online',function(e) {
              this.alertOnlineStatus();
          });
          window.addEventListener('offline',function(e) {
              this.alertOnlineStatus();
          });
      },
      beforeDestroy() {
          /*window.addEventListener('online',function(e) {
              this.alertOnlineStatus();
          });*/
          /*window.addEventListener('online', () => {
              this.alertOnlineStatus();
          }, false);
          window.removeEventListener('offline', this.alertOnlineStatus);*/
      },
  }
</script>

<style scoped lang="less">
  #app{
    .menu-top{
      height: 40px;
      width: 100vw;
    }
    .player{
      width: 100vw;
      height: calc(~'100vh - 40px');
    }
  }
</style>
